import { Config } from "../../src/config/Config"
import { DbConfig } from "../../src/config/DbConfig"
import { MysqlClient } from "../../src/engine/utils/MySqlClient"
import { MysqlManager } from "../../src/engine/utils/MysqlManager"

export class LogRateDao {

    private static getDbName() {
        // if (Config.environment == Config.EnvironmentType.yueyouhui) {
        //     return DbConfig.Db_Name.db_yxx2
        // }
        // else if(Config.environment == Config.EnvironmentType.xj){
        //     return DbConfig.Db_Name.db_yxx2
        // } 
        // else if(Config.environment == Config.EnvironmentType.Jk){
        //     return DbConfig.Db_Name.db_jk
        // }
        // else if(Config.environment == Config.EnvironmentType.chaoyou){
        //     return DbConfig.Db_Name.db_chaoyouhui
        // }
        // else {
            return DbConfig.Db_Name.db_yxx
        // }
    }


    public static async get_log_rate() {
        let client: MysqlClient = await MysqlManager.instance.getDb(this.getDbName());
        let sql: string = "select  * from  log_rate where rate > 0"
        let sqlParams = [];
        let results = await client.queryPromise(sql, sqlParams);
        if (results && results.length > 0) {
            return results
        } else {
            return []
        }
    }

}